package com.huan.dao.mapper;

import com.huan.pojo.Score;
import org.apache.ibatis.annotations.*;
import java.util.List;

public interface ScoreMapper {
    /**
     * 查询总记录数
     * @return
     */
    @Select("select count(*) from 选课及成绩")
    int selectTotalCount();


    /**
     * 分页条件查询
     * @param begin
     * @param size
     * @return
     */
    List<Score> selectByPageAndCondition(@Param("begin") int begin, @Param("size") int size, @Param("score") Score score);

    /**
     * 根据条件查询总记录数
     * @return
     */
    int selectTotalCountByCondition(Score score);

    /**
     * 增加
     * @param score
     */
    @Insert("insert into 选课及成绩 values(#{studentID},#{courseID},#{score},#{time},#{note})")
    boolean add(Score score);

    /**
     * 编辑
     * @param score
     */
    @Update("update 选课及成绩 set score = #{score},time = #{time},note = #{note} where studentID = #{studentID} and courseID = #{courseID}")
    int update(Score score);

    /**
     * 删除
     * @param studentID
     * @param courseID
     */
    @Delete("delete from 选课及成绩 where studentID = #{studentID} and courseID = #{courseID}")
    void delete(@Param("studentID")String studentID, @Param("courseID")String courseID);


}
